<!DOCTYPE html>
<html>
<head>
    <title>系统数据源管理</title>
	 <#include "/common/import.ftl" >
    <script type="text/javascript" src="${ctx}/js/utiltools.js"></script>
    <script type="text/javascript" src="${ctx}/js/easyui/extendvalidate.js"></script>
    <script type="text/javascript">
        var inputForm = '#inputForm';
        $(function () {

            $(inputForm).form({
                success: function (data) {
                    var result = jQuery.parseJSON(data);
                    if (result.flag == 'T') {
                        $.messager.confirm('提交结果', '操作成功', function () {
                            parent.colseAdd();// 关闭添加窗口
                            parent.cateReload();// 刷新列表
                        });
                    } else if (result.flag == 'F') {
                        $.messager.alert('提交结果', result.msg, 'info');
                    } else {
                        $.messager.alert('提交结果', '操作失败', 'error');
                    }
                },
                error: function (messg) {
                    $.messager.alert('错误提示', messg.responseText, 'error');
                }
            });
            $('#beanId').focus();
        });

        function doSubmit() {
            var flag = $(inputForm).form('validate');
            if (flag) {
                $(inputForm).submit();
            }
        }
    </script>
</head>
<body>
<div id="tip"></div>
<form id="inputForm" name="inputForm" method="post" action="${ctx}/source/save.action">
    <input type="hidden" name="formToken" id="formToken" value="${formToken!''}"/>
    <input type="hidden" name="isAdd" id="isAdd" value="${isAdd!''}"/>
<#if item.sysEname??>
     <input type="hidden" name="sysEname" value="${item.sysEname!''}"/>
</#if>
    <table class="datagrid-body">
        <tr>
            <td class="datagrid-header">数据源名称</td>
            <td>
                <input <#if item.dataName??>disabled="disabled"<#else> name="dataName"
                       data-options="required:true"</#if>
                       class="easyui-validatebox" value="${item.dataName!''}" size="40">
            </td>
        </tr>
        <tr>
            <td class="datagrid-header">系统标识</td>
            <td>
                <input <#if item.sysEname??>disabled="disabled"<#else> name="sysEname"
                       data-options="required:true"</#if>
                       class="easyui-validatebox" value="${item.sysEname!''}" size="40">
            </td>
        </tr>
        <tr>
            <td class="datagrid-header">数据库类型<font color=red>*</font></td>
            <td>
                <select name="databaseType" id="databaseType">
                    <option value="mysql">mysql</option>
                    <option value="oracle">oracle</option>
                    <option value="sqlserver">sqlserver</option>
                </select>
            </td>
        </tr>
        <tr>
            <td class="datagrid-header">驱动<font color=red>*</font></td>
            <td>
                <input name="driverClassName" value="${item.driverClassName!''}"
                       class="easyui-validatebox" data-options="required:true" size="40"
                       missingMessage="请输入驱动"/>
            </td>
        </tr>
        <tr>
            <td class="datagrid-header">连接地址<font color=red>*</font></td>
            <td>
                <input name="jdbcUrl" value="${item.jdbcUrl!''}"
                       class="easyui-validatebox" data-options="required:true" size="40"
                       missingMessage="请输入连接地址"/>
            </td>
        </tr>
        <tr>
            <td class="datagrid-header">用户名<font color=red>*</font></td>
            <td>
                <input name="jdbcUsername" value="${item.jdbcUsername!''}"
                       class="easyui-validatebox" data-options="required:true" size="40"
                       missingMessage="请输入用户名"/>
            </td>
        </tr>
        <tr>
            <td class="datagrid-header">密码<font color=red>*</font></td>
            <td>
                <input name="jdbcPassword" value="${item.jdbcPassword!''}"
                       class="easyui-validatebox" data-options="required:true" size="40"
                       missingMessage="请输入密码"/>
            </td>
        </tr>
        <tr>
            <td class="datagrid-header"></td>
            <td>
                <a href="#" class="easyui-linkbutton" id="bt1" iconCls="icon-save"
                   onclick="doSubmit();">提交</a>
                <a href="#" class="easyui-linkbutton" iconCls="icon-cancel"
                   onclick="parent.colseAdd();" ;>取消</a>
            </td>
        </tr>
    </table>
</form>
<script>
    UtilTools.initSelect("databaseType", "${item.databaseType!''}");
</script>

</body>
</html>
